<html>

<head>
	<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/media/css/base.css">
	<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/media/css/form.css">
	<script type="text/javascript" src="{{MEDIA_URL}}/media/js/jquery.js"></script>
	<script type="text/javascript" src="{{MEDIA_URL}}/media/js/sysmodel/flexyclass/field/add.js"></script>
</head>

<body>
	{% include "sysmodel/header.html" %}
	
	<div class="breadcrumbs">
			<a href="/sysmodel/home/">Home</a> &gt;
			<a href="/sysmodel/flexyclass/home/?#{{ flexyclass.id }}">{{ flexyclass.name }}</a> &gt;
			Add Field
	</div>
	
	<form enctype="multipart/form-data" action="/sysmodel/flexyclass/field/add/{{ flexyclass.id }}/" method="post">
		<div style="display:none">{% csrf_token %}</div>
		
		<span class="form-container"> 
			
			<span class="form-heading">
				<h4>Add Field ({{flexyclass.name}})</h4>
			</span>
			{% if rm %} <div class="errornote">{{ rm }}</div> {% endif %}
			<div class="form">

					<fieldset>
						<legend>Field</legend>
						<table>
							<tr>
								<td>
									<label>Field Name:</label>
								</td>
								<td>
									<input class="text" type="text" name="NAME"/>
								</td>
							</tr>
							<tr>
								<td>
									<label>Field Type:</label>
								</td>
								<td>
									<select id="FIELDTYPE" name="TYPE">
										{% for t in types %}
											<option value="{{t}}">{{t}}</option>
										{% endfor %}
									</select>
								</td>
							</tr>
							<tr id="CLASSLISTROW" class="hidden">
								<td>
									<label>Mapping Class:</label>
								</td>
								<td>
									<select id="CLASSLIST" name="CLASS_ID">
										{% for fc in flexyclasses %}
											<option value="{{fc.id}}">{{fc.name}}</option>
										{% endfor %}
									</select>
								</td>
							</tr>
							<tr id="FIELDLISTROW" class="hidden">
								<td>
									<label>Mapping Field:</label>
								</td>
								<td>
									<select id="FIELDLIST" name="SEL_FIELD_ID"></select>
								</td>
							</tr>
							<tr>
								<td>
									<label>Group Name:</label>
								</td>
								<td>
									<select name="GROUP_ID">
										{% for g in groups  %}
											<option value="{{g.id}}">{{g.name}}</option>
										{% endfor %}
									</select>
								</td>
							</tr>
							<tr>
								<td>
									<label>Enabled:</label>
								</td>
								<td>
									<input type="radio" name="ENB" value="1" CHECKED />Yes
									<input type="radio" name="ENB" value="0" />No
								</td>
							</tr>
						</table>
					</fieldset>
				
			</div>
			
			<span class="form-submit">
				<input class="submit" type="submit" value="Save"/>
				<input class="submit" type="reset" value="Reset"/>
			</span>
			
		</span>
	</form>
	
	<div class="hidden">
		<ul id="CHAR_UNIQ_FIELD_LIST" >
			{% for f in fields %}
				<li flexyclass_id="{{f.flexyclass.id}}" field_id="{{f.id}}">{{f.name}}</li>
			{% endfor %}
		</ul>
	</div>
</body>

</html>
